//
//  MinePurchaseRecordModel.swift
//  MT
//
//  Created by M on 2019/12/31.
//  Copyright © 2019 张强. All rights reserved.
//

import UIKit
import ObjectMapper

class MinePurchaseRecordResponseModel: Mappable {

    var code: Int?
    
    var result: [MinePurchaseRecordModel]?
    
    required init?(map: Map) {
        
    }
    
    open func mapping(map: Map) {
        code            <- map["code"]
        result          <- map["result"]
    }
    
}

class MinePurchaseRecordModel: Mappable {
    
    var amount: Int = 0
    
    var createTime: String?
    
    // 消费状态: 1购买礼物，2发红包,3提现成功,4创建俱乐部，5创建活动；获取钻石状态: 6充值，7收红包,8收礼物，9红包退还，10提现失败
    var purchaseType: Int = 0
    
    @objc
    enum PurchaseType: Int {
        
        /// 消费状态
        case buy_gift                           = 1         // 购买礼物
        case send_red_pocket                    = 2         // 发红包
        case withdraw_deposit_success           = 3         // 提现成功
        case create_club                        = 4         // 创建俱乐部
        case create_activity                    = 5         // 创建活动
        
        /// 获取钻石状态
        case recharge                           = 6         // 充值
        case receive_red_pocket                 = 7         // 收红包
        case receive_gift                       = 8         // 收礼物
        case return_red_pocket                  = 9         // 红包退还
        case withdraw_deposit_fail              = 10        // 提现失败
        
        /// 标题
        var title: String {
            switch self {
            
            case .buy_gift:
                return "购买礼物"
            case .send_red_pocket:
                return "发红包"
            case .withdraw_deposit_success:
                return "提现成功"
            case .create_club:
                return "创建俱乐部"
            case .create_activity:
                return "创建活动"
            case .recharge:
                return "充值"
            case .receive_red_pocket:
                return "收红包"
            case .receive_gift:
                return "收礼物"
            case .return_red_pocket:
                return "红包退还"
            case .withdraw_deposit_fail:
                return "提现失败"
            }
        }
        
        /// status - 消费状态
        @objc
        enum Status: Int {
            case expense
            case receive
        }
        var status: Status {
            switch self {
            case .buy_gift, .send_red_pocket, .withdraw_deposit_success, .create_club, .create_activity:
                return .expense
            default:
                return .receive
            }
        }
        
    }
    
    required init?(map: Map) {
        
    }
    
    open func mapping(map: Map) {
        amount          <- map["amount"]
        createTime      <- map["createTime"]
        purchaseType    <- map["purchaseType"]
    }
    
}
